/*
-------------------------------------------
    Rodeo Game Engine
    Rodeo Renderer Module
    GLSLShaders.h - header file
    Copyright(c) Marcin Goryca
-------------------------------------------
*/
#ifndef RODEO_RENDERER_GLSLSHADERS_H_
#define RODEO_RENDERER_GLSLSHADERS_H_

#ifndef RODEO_GLLIBS_H_
#include "..\..\gllibs.h"
#endif

#ifndef RODEO_RENDERER_SHADERSINTERFACE_H_
#include "renderer\shadersinterface.h"
#endif

namespace rodeorenderer
{
class GLSLShaders : public ShadersInterface
{
public:
    GLSLShaders()
    {}

    virtual ~GLSLShaders()
    {}

    // Loads Shader from File
    // Parameter const char* string of shader filename
    // Parameter ShaderType - RODEO_VS, RODEO_FS
    // Returns unsigned int shader program id
    virtual rodeocore::ui loadShaderFromFile(const char* filename, rodeocore::ShaderType st);

    // Loads Shaders from files
    void loadShaders(std::string vertex_file, std::string fragment_file);

    // Inits Shaders
    virtual void init();

    // Uses ShaderProgram
    virtual void useShaderProgram(rodeocore::ui shader_program);
  
    virtual const char* getVertexProgramFile() const 
    {
        return vertex_program_file_;
    }

    virtual void setVertexProgramFile(const char* vpf)
    {
        vertex_program_file_ = vpf;
    }

    virtual const char* getFragmentProgramFile() const
    {
        return fragment_program_file_;
    }

    virtual void setFragmentProgramFile(const char* fpf)
    {
        fragment_program_file_ = fpf;
    }

    virtual rodeocore::ui getVertexShader() const
    {
        return vertex_shader_;
    }

    virtual void setVertexShader(rodeocore::ui id)
    {
        vertex_shader_ = id;
    }

    virtual rodeocore::ui getFragmentShader() const
    {
        return fragment_shader_;
    }

    virtual void setFragmentShader(rodeocore::ui id)
    {
        fragment_shader_ = id;
    }

    virtual rodeocore::ui getProgram() const { return program_; }

    virtual void setProgram(rodeocore::ui program) { program_ = program; }

private:
    // Copy constructor
    GLSLShaders(const GLSLShaders& copy);

    // Copy operator
    GLSLShaders operator=(const GLSLShaders& copy);

    // Helper method to read shader file
    char* readFile(const char* file);

//==== MEMBERS ====//
    rodeocore::ui program_;
};
}    // end of rodeorenderer namespace
#endif // RODEO_RENDERER_GLSLSHADERS_H_